package calao.util;

import static calao.util.Logger.INFO;

import java.io.PrintWriter;
import java.text.SimpleDateFormat;

public class ConsoleHandler 
extends LogHandler 
{

	LogLevel level = INFO;
	
	final static SimpleDateFormat TIME_FORMAT = new SimpleDateFormat("HH:mm:ss.SSS");

	final PrintWriter writer = new PrintWriter(System.out);

	public synchronized void handle(LogRecord record) 
	{
		printTo(record, writer);
	}

	@Override
	public boolean handles(LogLevel level) {
		return level.getSeverity()>=this.level.getSeverity();
	}
	
	public void setLevel(LogLevel level)
	{
		this.level = level;
	}

}
